package com.study;

import com.alibaba.fastjson.JSON;
import org.apache.commons.lang3.StringUtils;

import java.util.*;

/**
 * TODO
 *
 * @author wanghuilong
 * @version 1.0
 * @date 2021/11/11 3:53 下午
 */
public class Test4 {


    public static void main(String[] args) {
        String str = "com.jkys.share.product.client.service.business.ItemManageService#shopGoodsPage(分页查询门店商品信息)com.jkys.middleground.merchant.client.service.MerchantServerRpcService#queryMerchantInfos(查询商家信息)com.jkys.share.tms.client.service.ShopService#batchQueryShopFullData(批量查询店铺相关全量数据)com.jkys.middleground.merchant.client.service.MerchantServerRpcService#queryMerchantExtInfos(批量查询门店扩展信息)\n" +
                "com.jkys.share.product.client.service.business.ItemManageService#storeGoodsPage(分页查询商家商品信息)com.jkys.middleground.merchant.client.service.MerchantServerRpcService#queryMerchantInfos(查询商家信息)\n" +
                "com.jkys.share.product.client.service.business.ItemManageService#shopGoodsPage(分页查询门店商品信息)com.jkys.middleground.merchant.client.service.MerchantServerRpcService#queryMerchantInfos(查询商家信息)com.jkys.share.tms.client.service.ShopService#batchQueryShopFullData(批量查询店铺相关全量数据)com.jkys.middleground.merchant.client.service.MerchantServerRpcService#queryMerchantExtInfos(批量查询商家扩展信息)\n" +
                "com.jkys.share.product.client.service.business.ItemManageService#storeGoodsPage(分页查询商家商品信息)com.jkys.middleground.merchant.client.service.MerchantServerRpcService#queryMerchantInfos(查询商家信息)\n" +
                "com.jkys.share.product.client.service.business.ItemManageService#listSimpleStoreGoods(查询商家商品简要信息)com.jkys.share.product.client.service.business.DrugStoreShareService#matchMedicineInfoByProductIds(根据智云商品SKUID匹配)com.jkys.share.product.client.service.business.ItemManageService#saveMatchResult(批量保存匹配结果)\n" +
                "com.jkys.share.product.client.service.business.ItemSearchService#batchQuerySimpleItemInfoForBacked(批量查询商品简要信息-运营后台使用)com.jkys.middleground.merchant.client.service.MerchantServerRpcService#queryMerchantExtInfos(批量查询商家扩展信息)com.jkys.share.product.client.service.business.ItemManageService#getExistsItemCodes(判断itemCode是否存在)com.jkys.share.product.client.service.business.CoefficientManageService#query(查询推广系数)com.jkys.share.product.client.service.business.CoefficientManageService#batchAdd(批量编辑渠道系数)com.jkys.share.product.client.service.business.ItemManageService#setSaleChannels(修改推广系数)\n" +
                "com.jkys.share.product.client.service.business.ItemManageService#getExistsItemCodes(判断itemCode是否存在)com.jkys.share.product.client.service.business.ItemManageService#shopGoodsPage(分页查询门店商品信息)com.jkys.middleground.merchant.client.service.MerchantServerRpcService#queryMerchantInfos(查询商家信息)com.jkys.share.product.client.service.ProductTemplateBasicService#queryDrugsByName(根据通用名列表查询)com.jkys.share.product.client.service.business.ItemManageService#updateShopGoodsStatusV2(直接修改商品的上下架状态)\n" +
                "com.jkys.share.product.client.service.business.ItemManageService#listProductKeyInfo(批量查询商品的关键信息)com.jkys.share.product.client.service.business.ItemManageService#saveProductNames(批量修改药品商品名)\n" +
                "com.jkys.share.product.client.service.business.CoefficientManageService#query(查询推广系数)com.jkys.share.product.client.service.business.CoefficientManageService#batchAdd(批量编辑渠道系数)\n" +
                "com.jkys.share.product.client.service.business.ItemManageService#listProductKeyInfo(批量查询商品的关键信息)com.jkys.share.product.client.service.business.NewCategoryService#getAllBackedCategory(查询所有后端类目)com.jkys.share.product.client.service.business.NewCategoryService#queryAllSimpleDoctorCategory(查询所有医生端类目简要信息)com.jkys.share.product.client.service.business.ItemManageService#saveProductToCategory(更新商品类目)com.jkys.share.product.client.service.business.ItemManageService#saveProductNames(批量修改药品商品名)\n" +
                "com.jkys.share.product.client.service.business.ItemManageService#listSimpleStoreGoods(查询商家商品简要信息)com.jkys.share.product.client.service.business.DrugStoreShareService#matchMedicineInfoByProductIds(根据智云商品SKUID匹配)com.jkys.share.product.client.service.business.ItemManageService#saveMatchResult(批量保存匹配结果)\n" +
                "com.jkys.middleground.merchant.client.service.MerchantServerRpcService#queryMerchantExtInfos(批量查询商家扩展信息)com.jkys.share.product.client.service.business.ItemManageService#setSaleChannels(修改推广系数)\n" +
                "com.jkys.share.product.client.service.business.ItemManageService#getStoreOriginProductInfo(获取商家商品源信息)com.jkys.middleground.merchant.client.service.MerchantServerRpcService#queryMerchantInfos(查询商家信息)\n" +
                "com.jkys.share.product.client.service.ProductBasicService#queryFourKeySimilarSku(系统建议匹配列表)\n" +
                "com.jkys.share.product.client.service.ProductBasicService#drugStoreProductDetail(根据skuCode查询商品详情)\n" +
                "com.jkys.share.product.client.service.business.ItemManageService#updateShopGoodsStatusV2(直接修改商品的上下架状态)com.jkys.share.product.client.service.business.ItemManageService#shopGoodsPage(分页查询门店商品信息)com.jkys.middleground.merchant.client.service.MerchantServerRpcService#queryMerchantInfos(查询商家信息)com.jkys.share.product.client.service.ProductTemplateBasicService#queryDrugsByName(根据通用名列表查询)\n" +
                "com.jkys.share.product.client.service.business.ItemManageService#saveProductToCategory(更新商品类目)\n" +
                "com.jkys.share.product.client.service.business.ItemManageService#applyForecastCategory(更新预测类目)\n" +
                "com.jkys.share.product.client.service.business.NewCategoryService#getAllBackedCategory(查询所有后端类目)\n" +
                "com.jkys.share.product.client.service.business.NewCategoryService#getAllCategoryByFirstLevel(查询所有的一级类目)\n" +
                "com.jkys.share.product.client.service.business.NewCategoryService#queryAllBackedByCategoryList(批量查询后端类目)\n" +
                "com.jkys.share.product.client.service.business.NewCategoryService#getAllByParentCode(根据父类目code查询类目)\n" +
                "com.jkys.share.product.client.service.business.NewCategoryService#getAllFrontInfoCategoryByList(查询所有前端类目信息)com.jkys.share.product.client.service.business.NewCategoryService#updateAppCategorySort(更新前端类目)\n" +
                "com.jkys.share.product.client.service.business.NewCategoryService#checkExistsFrontName(检查前端类目名称是否存在)com.jkys.share.product.client.service.business.NewCategoryService#checkBatchNameFrontCategory(批量检查名字一二级类目关系是否存在)com.jkys.share.product.client.service.business.NewCategoryService#checkExistsBackedIds(检查后端类目id是否存在)com.jkys.share.product.client.service.business.NewCategoryService#batchAddFrontCategory(批量增加前端类目)\n" +
                "com.jkys.share.product.client.service.business.NewCategoryService#checkExistsBackedIds(检查后端类目id是否存在)com.jkys.share.product.client.service.business.NewCategoryService#getAllFrontInfoCategoryByList(查询所有前端类目信息)com.jkys.share.product.client.service.business.NewCategoryService#checkBatchIdFrontCategory(校验一级类目和二级类目关系)com.jkys.share.product.client.service.business.NewCategoryService#checkExistsFrontName(检查前端类目名称是否存在)com.jkys.share.product.client.service.business.NewCategoryService#batchUpdateFrontCategory(批量更新前台类目)\n" +
                "com.jkys.share.product.client.service.business.NewCategoryService#updateAppCategorySort(商城类目更新顺序)\n" +
                "com.jkys.share.product.client.service.business.NewCategoryService#queryAllDoctorCategory(获得所有医生端类目)\n" +
                "com.jkys.share.product.client.service.business.NewCategoryService#saveDoctorCategory(增加医生端类目)\n" +
                "com.jkys.share.product.client.service.business.NewCategoryService#updateDoctorCategory(医生端类目更新)\n" +
                "com.jkys.share.product.client.service.business.NewCategoryService#updateDoctorCategory(医生端类目更新)\n" +
                "com.jkys.middleground.merchant.client.service.MerchantServerRpcService#queryMerchantPage(查询门店是否自营列表)com.jkys.share.product.client.service.business.NewCategoryService#getShopCategoryForApp(获取店铺类目数)\n" +
                "com.jkys.share.product.client.service.business.NewCategoryService#queryAllSimpleDoctorCategory(获取所有简单的医生端类目)\n" +
                "com.jkys.share.product.client.service.business.NewCategoryService#batchAddBackCategory(批量增加后端类目)\n" +
                "com.jkys.share.product.client.service.business.ProductTagService#getTagGroupDetail(根据标签组搜索标签简要信息列表)com.jkys.share.product.client.service.business.ProductTagService#searchTag(根据名称搜索标签)\n" +
                "com.jkys.share.product.client.service.business.ItemManageService#getShopGoodsDetail(查询商品详情)com.jkys.middleground.merchant.client.service.MerchantServerRpcService#queryMerchantInfo(查询商家信息)com.jkys.middleground.merchant.client.service.MerchantServerRpcService#queryMerchantExtInfo(查询商家扩展信息)com.jkys.share.product.client.service.business.CoefficientManageService#query(查询推广系数)\n" +
                "com.jkys.share.product.client.service.business.ProductTagService#addTagGroup(添加标签组)\n" +
                "com.jkys.share.product.client.service.business.ProductTagService#pageQueryTagGroup(查询标签组列表数据)\n" +
                "com.jkys.share.product.client.service.business.ProductTagService#addTag(添加标签值)\n" +
                "com.jkys.share.product.client.service.business.ProductTagService#batchUpdateTagName(修改标签值)\n" +
                "com.jkys.share.product.client.service.business.ProductTagService#getTagGroupDetail(查询标签值列表数据)\n" +
                "com.jkys.share.product.client.service.business.ProductTagService#deleteTag(通过标签值ID删除标签值)\n" +
                "com.jkys.share.product.client.service.business.ProductTagService#deleteTagGroup(通过标签组id删除标签组)\n" +
                "com.jkys.share.product.client.service.business.ProductTagService#exportTagInfo(导出标签组数据)\n" +
                "com.jkys.share.product.client.service.business.ProductTagService#batchAddTag(批量新增标签组数据)\n" +
                "com.jkys.share.product.client.service.business.ProductTagService#batchUpdateTag(批量更新标签组数据)\n" +
                "com.jkys.share.product.client.service.business.ItemManageService#saveGoodsTags(批量打标)\n" +
                "com.jkys.share.product.client.service.business.ItemManageService#saveGoodsTags(批量打标)\n" +
                "com.jkys.share.product.client.service.business.ProductTagService#updateTagStatus(修改标签值状态)\n" +
                "com.jkys.share.product.client.service.business.ProductTagService#getTagTreeInfo(获取标签组结果树)\n" +
                "com.jkys.share.product.client.service.business.ProductTagService#batchAddTagForGnu(给中央药品库批量打标)";
        Set<String> set = new HashSet<>();
        String[] split = str.split("\n");
        for (String line : split) {
            line = line.trim();
            if (StringUtils.isNotBlank(line)) {
                String[] strArr = line.split("\\)");
                for (String s : strArr) {
                    set.add(s);
                }
            }
        }

        Map<String, Set<String>> map = new HashMap<>();
        for (String s : set) {
            String[] split1 = s.split("\\(");
            String inter = split1[0];
            String text = split1[1].replace("）", "");
            Set<String> strings = map.computeIfAbsent(inter, v -> new HashSet<>());
            strings.add(text);
        }

        for (Map.Entry<String, Set<String>> entry : map.entrySet()) {
            System.out.println(entry.getKey() + "\t" + JSON.toJSONString(entry.getValue()));
        }
    }

}
